473,520 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a clickable button or text into a image with GD

Hi there

I just wondered if there is any way using GD to insert a clickable
button or some clickable text into a image? It is possible to create
images for buttons but what if you want a clickable button *inside*
another image.

I don't know if this is along the right lines but the following code
puts a image inside another image. Perhaps I could then make im2
clickable or is it just not possible? Any help would be very much
appreciated!

Thanks
Chris

<?php
$im = ImageCreate(800,800);
$im_color = ImageColorAllocate($im, 0, 255, 0);

$im2 = ImageCreate(200,200);
$im_color2 = ImageColorAllocate($im2, 255, 0, 0);

// copy image into new resource
imagecopy($im, $im2, 0, 0, 0, 0, 60, 60 );

header ("Content-type: image/png");
ImagePNG($im);
?>

Oct 18 '07 #1
3 5548
On Thu, 18 Oct 2007 16:39:39 +0200, <cr***********@hotmail.comwrote:
Hi there

I just wondered if there is any way using GD to insert a clickable
button or some clickable text into a image? It is possible to create
images for buttons but what if you want a clickable button *inside*
another image.

I don't know if this is along the right lines but the following code
puts a image inside another image. Perhaps I could then make im2
clickable or is it just not possible? Any help would be very much
appreciated!
Please read up on your html. An image will always be just an image. Any
'click'-detection has to come from something else. In html <input
type="image"and imagemaps come to mind.

Also, with HTML, it would be a nightmare to maintain/update images with
fixed button images inside on an update. Just use CSS positioning, which
is most userfriendly and portable.
--
Rik Wasmus
Oct 18 '07 #2
In our last episode,
<11**********************@q5g2000prf.googlegroups. com>,
the lovely and talented cr***********@hotmail.com
broadcast on comp.lang.php:
Hi there
I just wondered if there is any way using GD to insert a clickable
button or some clickable text into a image? It is possible to create
images for buttons but what if you want a clickable button *inside*
another image.
I don't know if this is along the right lines but the following code
puts a image inside another image. Perhaps I could then make im2
clickable or is it just not possible? Any help would be very much
appreciated!
You can make an area of an image clickable with the HTML map element.
The clickability is not in the image. It is in the HTML. You can put stuff
in an image that looks like a button, but that doesn't make it clickable.
You can also make parts of an image clickable without putting anything in
the image that looks like a button.
Thanks
Chris
><?php
$im = ImageCreate(800,800);
$im_color = ImageColorAllocate($im, 0, 255, 0);
$im2 = ImageCreate(200,200);
$im_color2 = ImageColorAllocate($im2, 255, 0, 0);
// copy image into new resource
imagecopy($im, $im2, 0, 0, 0, 0, 60, 60 );
header ("Content-type: image/png");
ImagePNG($im);
?>
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 460 days to go.
What do you do when you're debranded?
Oct 18 '07 #3
cr***********@hotmail.com wrote:
Hi there

I just wondered if there is any way using GD to insert a clickable
button or some clickable text into a image? It is possible to create
images for buttons but what if you want a clickable button *inside*
another image.
Yup. Its not that hard - there are some ways to do it: Here is mine.

Use a background image in a table cell. Then add clickable text or
another image over the top.

If you specify the table cell size and use non repeating backgrounds of
transperent edged GIFS it needn;t be a reatngular image either.

>
I don't know if this is along the right lines but the following code
puts a image inside another image. Perhaps I could then make im2
clickable or is it just not possible? Any help would be very much
appreciated!

Thanks
Chris

<?php
$im = ImageCreate(800,800);
$im_color = ImageColorAllocate($im, 0, 255, 0);

$im2 = ImageCreate(200,200);
$im_color2 = ImageColorAllocate($im2, 255, 0, 0);

// copy image into new resource
imagecopy($im, $im2, 0, 0, 0, 0, 60, 60 );

header ("Content-type: image/png");
ImagePNG($im);
?>
Oct 18 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
4898
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore when I pass the mouse over the logo. Is there a way to replace a link by an image that will still be clickable? Thanks, -- Kerberos.
1
4004
by: Roedy Green | last post by:
..button /* clickable button */ { background-color : #f1f391; color : #7b3e00; border : 3px outset #d2d2d2; margin : 0px 2px 0px 2px; font-family :Arial,Helvetica,sans-serif; font-size : 120%; padding : 0px 6px 0px 6px; }
16
3156
by: Picho | last post by:
Hi all, Is there any .NET way (I am not rulling out API usage) to add button(s) to a form's title bar? I found some non-.NET solutions that did actually work in VB6 but not in the ..NET forms... I tried painting, but the paintaing area provided by the form is only the client area - no visible way to paint on the title bar.
1
1710
by: Jonas L | last post by:
I have created a derived version of a normal form, e.g. called MyForm (public class MyForm : System.Windows.Forms.Form). The form is simply specifing a standard icon that we use within the company. This fairly straight forward and not a problem. We have planed to use this form as the base form to all other forms in our application. The...
12
6313
by: Ted Weatherly | last post by:
Is it possible to create a clickable time zone map on a web page? Is it as simple as finding an image of world time zones and declaring a bunch image map coordinates? Has someone already done this? -Ted
1
2552
by: Nathan Sokalski | last post by:
I have navigation that is made out of a table. I did this so that I could dynamically create my "buttons" (the cells formatted using CSS) and avoid creating a new graphic every time I changed the text of a button. However, because TableCells are not clickable, this only allows the user to click on the text used in the button. Because all my...
1
5701
by: =?ISO-8859-1?Q?Fran=E7ois_de_Dardel?= | last post by:
The URL is: http://dardel.info/tintin/random.html What I want to achieve: When you click a thumbnail, a window opens with a larger copy of the pict _as the background_. I want the new window to close when clicking anywhere on it. Both the background of the window and the caption are produced by Javascript, but the probleme is not here.
3
2172
by: breakupemail | last post by:
Hello, on my website at http://www.breakupemail.com/ there is a horizontal navigation bar with 6 hyperlinks. Recently, I added a second navigation row below the first, with 2 links. Once this second navigation bar was added, the clickable area on the 6 links in the top row became greatly reduced when viewed in Firefox 2.0.0.9. It seems to work...
2
7043
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so the entire block is clickable, not just the text. I've sorta got it so it's clickable, just some parts of the button I still can't click on. The...
0
7219
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7613
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7177
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5756
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5138
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3287
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1663
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.